<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>demo18-jquery普通事件</title>
    <script src="js/jquery-1.11.1.js"></script>
    <style type="text/css">
        #btn{
            position: fixed;
            top: 50px;;
        }
    </style>

</head>
<body>
    <p>这是P标签</p>
    <div>
        <input type="text" value="123456"/>
        <span style="display: none">已获取焦点</span>
    </div>
</body>
</html>

<script>

//    $('p').click(function () {
//        alert($(this).text())
//    })

    $('p').dblclick(function () {
        alert('这里是双击事件')
    })

    $('div').focusin(function () {
        $(this).children('span').show();
    })


    var x = 100;
    var inc = function(){
        var x = 0;
        return function(){
            console.log(x);
            console.log(x++);
        };
    };

    var inc1 = inc();
    var inc2 = inc();

    inc1();  // -> 0
</script>